def equal(filename1, filename2):
    f1 = open(filename1, 'r')
    f2 = open(filename2, 'r')
    if f1.read() == f2.read():
        print('compare ok')
    else:
        print('not equal')


equal('file3.txt', 'file1.txt')
equal('file1.txt', 'file2.txt')